import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Lobster here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Lobster extends Actor
{   
    int cout=0;
    /**
     * Act - do whatever the Lobster wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
public void act(){
        // Add your action code here.
        move(6);
        eat();
        turnAtEdge();
        int sj=Greenfoot.getRandomNumber(20);
        turn(sj-10);
   
}

public void turnAtEdge(){
    if(isAtEdge())
    {    
        turn(20);
    }
}

public void eat(){
    if(isTouching (Crab.class)){
         Actor actor=getOneIntersectingObject(Crab.class);   
         CrabWorld world=(CrabWorld)getWorld();
         world.removeObject(actor);
         
    }
}
}
